home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- title SOFTBELL - Routine to soften the bell
- subttl (C) Copyright 1985,86 by System Enhancement Associates
- page
- ;
- ; The normal system bell tone used when a "control G" is printed
- ; is a rather strident tone, suitable for calling one's attention.
- ; However, in many cases one doesn't wish to have one's machine
- ; emitting such loud noises. In these cases, Softbell can be used
- ; to mute the tone, producing a less obtrusive low buzz.
- ;
- ; This will not affect tones produced in other ways.
- ;
- ; This program is also a good example of how to write a resident
- ; routine that adds features to an existing system call.
- ;
- page
-
- code segment
- assume cs:code,ds:code,es:code,ss:code
-
- org 100h
- soft: jmp start ;system entry point
- oldint equ $ ;storage for old interrupt vector
- oldoff dw ? ;old interrupt offset
- oldseg dw ? ;old interrupt segment
-
- newint: sti ;routine for new interrupt vector
- cmp ah,0eh ;output call?
- jz usenew ;yes - see what is being output
- useold: jmp dword ptr cs:oldint ;no - pass it to BIOS
-
- usenew: cmp al,7 ;is it a bell?
- jnz useold ;no - let BIOS handle it
-
- push ax ;save our registers
- push bx
- push cx
-
- mov bx,30 ;tone duration
- in al,61h ;get speaker status
- push ax ;save original status
- sti ;this can be interrupted
-
- loop1: and al,0fch ;speaker off
- out 61h,al
- mov cx,2100 ;half tone delay
- loop2: loop loop2
-
- or al,2 ;speaker on
- out 61h,al
- mov cx,2100 ;half tone delay
- loop3: loop loop3
-
- dec bx ;tone duration
- jnz loop1
-
- pop ax ;restore speaker status
- out 61h,al
- pop cx ;recover registers
- pop bx
- pop ax
- iret ;all done here
-
- endres equ $ ;end of resident portion
-
- banner db 'SOFTBELL; Version '
- TED_VERSION DB '1.04, created on '
- TED_DATE DB '02/02/86 at '
- TED_TIME DB '01:26:16',13,10
- db '(C) COPYRIGHT 1985,86 by System Enhancement Associates;'
- db ' ALL RIGHTS RESERVED',13,10,10
- db ' Resident portion loaded, Boss!',13,10,'$'
-
- start: mov ax,3510h ;read video call vector
- int 21h
- mov oldoff,bx ;save offset
- mov oldseg,es ;save segment
-
- mov dx,offset newint ;get address of new routine
- mov ax,2510h ;write video call vector
- int 21h
-
- mov dx,offset banner ;point to our greeting
- mov ah,9 ;print string
- int 21h
-
- mov dx,offset endres ;end of resident code
- int 27h ;terminate and stay resident
-
- code ends
- end soft
-